/**
 * 文件分片
 * @export
 * @param {Object} file 浏览器FIle对象 
 * @param {number} size 分片大小 字节
 * @return {Array} 分片结果 
 */
export function burst(file, size = 1024) {
    let result = [], start = 0, end = 0;
    while (true) {
        end += size
        var burst = file.slice(start, end)
        if (!burst.size) {
            break;
        }
        result.push(burst)
        start += size
    }
    console.log('分片长度',result.length)
    return result
}

/**
 *
 *
 * @export
 * @param {Blob} blob
 */
export function blobString(blob){
    return new Promise((resolve, reject)=>{
        const reader = new FileReader()
        reader.onload = function(){
            resolve(reader.result)
        }
        reader.readAsText(blob)
    })
}